using NLog;
using NLog.Web;

namespace RobotClient
{
    public class Program
    {

        /// <param name="args"></param>
        public static void Main(string[] args)
        {
            var builder = WebApplication.CreateBuilder(args);
            builder.Configuration.AddJsonFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configures/cloudmqttclient.json"), true, true);
            builder.Configuration.AddJsonFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configures/localmqttclient.json"), true, true);
            builder.Configuration.AddJsonFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configures/robotbase.json"), true, true);
            builder.Configuration.AddJsonFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configures/database.json"), true, true);
            builder.Configuration.AddJsonFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configures/navinfo.json"), true, true);
            LogManager.Setup().LoadConfigurationFromFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configures/NLog.config"));
            builder.Logging.ClearProviders();
            builder.Host.UseNLog();
            var startup = new StartUp(builder.Configuration);
            startup.ConfigureServices(builder.Services);
            var app = builder.Build();
            startup.Configure(app, builder.Environment);
            app.Run();

        }
    }
}
